/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.components;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart;
import org.eclipse.emf.eef.runtime.context.PropertiesEditingContext;
import org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent;
import org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider;
import org.omg.deployment.PlanConnectionDescription;
import org.omg.deployment.parts.ConnectionEndsPropertiesEditionPart;
import org.omg.deployment.parts.DeploymentViewsRepository;
import org.omg.deployment.parts.PlanConnectionDescriptionPropertiesEditionPart;
import org.omg.deployment.parts.RequirementsPropertiesEditionPart;


/**
 * @author Toby McClean; Zeligsoft (2009) Limited
 * @generated
 */
public class PlanConnectionDescriptionPropertiesEditionComponent extends ComposedPropertiesEditionComponent {

	/**
	 * The Base part
	 * @generated
	 */
	private PlanConnectionDescriptionPropertiesEditionPart basePart;

	/**
	 * The PlanConnectionDescriptionBasePropertiesEditionComponent sub component
	 * @generated
	 */
	protected PlanConnectionDescriptionBasePropertiesEditionComponent planConnectionDescriptionBasePropertiesEditionComponent;

	/**
	 * The ConnectionEnds part
	 * @generated
	 */
	private ConnectionEndsPropertiesEditionPart connectionEndsPart;

	/**
	 * The PlanConnectionDescriptionConnectionEndsPropertiesEditionComponent sub component
	 * @generated
	 */
	protected PlanConnectionDescriptionConnectionEndsPropertiesEditionComponent planConnectionDescriptionConnectionEndsPropertiesEditionComponent;
	/**
   * The Requirements part
   * @generated
   */
  private RequirementsPropertiesEditionPart requirementsPart;

  /**
   * The PlanConnectionDescriptionRequirementsPropertiesEditionComponent sub component
   * @generated
   */
  protected PlanConnectionDescriptionRequirementsPropertiesEditionComponent planConnectionDescriptionRequirementsPropertiesEditionComponent;
  /**
	 * Parameterized constructor
	 * 
	 * @param planConnectionDescription the EObject to edit
	 * @generated
	 */
	public PlanConnectionDescriptionPropertiesEditionComponent(PropertiesEditingContext editingContext, EObject planConnectionDescription, String editing_mode) {
    super(editingContext, editing_mode);
    if (planConnectionDescription instanceof PlanConnectionDescription) {
      PropertiesEditingProvider provider = null;
      provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(planConnectionDescription, PropertiesEditingProvider.class);
      planConnectionDescriptionBasePropertiesEditionComponent = (PlanConnectionDescriptionBasePropertiesEditionComponent)provider.getPropertiesEditingComponent(editingContext, editing_mode, PlanConnectionDescriptionBasePropertiesEditionComponent.BASE_PART, PlanConnectionDescriptionBasePropertiesEditionComponent.class);
      addSubComponent(planConnectionDescriptionBasePropertiesEditionComponent);
      provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(planConnectionDescription, PropertiesEditingProvider.class);
      planConnectionDescriptionConnectionEndsPropertiesEditionComponent = (PlanConnectionDescriptionConnectionEndsPropertiesEditionComponent)provider.getPropertiesEditingComponent(editingContext, editing_mode, PlanConnectionDescriptionConnectionEndsPropertiesEditionComponent.CONNECTIONENDS_PART, PlanConnectionDescriptionConnectionEndsPropertiesEditionComponent.class);
      addSubComponent(planConnectionDescriptionConnectionEndsPropertiesEditionComponent);
      provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(planConnectionDescription, PropertiesEditingProvider.class);
      planConnectionDescriptionRequirementsPropertiesEditionComponent = (PlanConnectionDescriptionRequirementsPropertiesEditionComponent)provider.getPropertiesEditingComponent(editingContext, editing_mode, PlanConnectionDescriptionRequirementsPropertiesEditionComponent.REQUIREMENTS_PART, PlanConnectionDescriptionRequirementsPropertiesEditionComponent.class);
      addSubComponent(planConnectionDescriptionRequirementsPropertiesEditionComponent);
    }
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
	 *      getPropertiesEditionPart(int, java.lang.String)
	 * @generated
	 */
	public IPropertiesEditionPart getPropertiesEditionPart(int kind, String key) {
    if (PlanConnectionDescriptionBasePropertiesEditionComponent.BASE_PART.equals(key)) {
      basePart = (PlanConnectionDescriptionPropertiesEditionPart)planConnectionDescriptionBasePropertiesEditionComponent.getPropertiesEditionPart(kind, key);
      return (IPropertiesEditionPart)basePart;
    }
    if (PlanConnectionDescriptionConnectionEndsPropertiesEditionComponent.CONNECTIONENDS_PART.equals(key)) {
      connectionEndsPart = (ConnectionEndsPropertiesEditionPart)planConnectionDescriptionConnectionEndsPropertiesEditionComponent.getPropertiesEditionPart(kind, key);
      return (IPropertiesEditionPart)connectionEndsPart;
    }
    if (PlanConnectionDescriptionRequirementsPropertiesEditionComponent.REQUIREMENTS_PART.equals(key)) {
      requirementsPart = (RequirementsPropertiesEditionPart)planConnectionDescriptionRequirementsPropertiesEditionComponent.getPropertiesEditionPart(kind, key);
      return (IPropertiesEditionPart)requirementsPart;
    }
    return super.getPropertiesEditionPart(kind, key);
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
	 *      setPropertiesEditionPart(java.lang.Object, int,
	 *      org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart)
	 * @generated
	 */
	public void setPropertiesEditionPart(java.lang.Object key, int kind, IPropertiesEditionPart propertiesEditionPart) {
    if (DeploymentViewsRepository.PlanConnectionDescription.class == key) {
      super.setPropertiesEditionPart(key, kind, propertiesEditionPart);
      basePart = (PlanConnectionDescriptionPropertiesEditionPart)propertiesEditionPart;
    }
    if (DeploymentViewsRepository.ConnectionEnds.class == key) {
      super.setPropertiesEditionPart(key, kind, propertiesEditionPart);
      connectionEndsPart = (ConnectionEndsPropertiesEditionPart)propertiesEditionPart;
    }
    if (DeploymentViewsRepository.Requirements.class == key) {
      super.setPropertiesEditionPart(key, kind, propertiesEditionPart);
      requirementsPart = (RequirementsPropertiesEditionPart)propertiesEditionPart;
    }
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
	 *      initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
	 *      org.eclipse.emf.ecore.resource.ResourceSet)
	 * @generated
	 */
	public void initPart(java.lang.Object key, int kind, EObject element, ResourceSet allResource) {
    if (key == DeploymentViewsRepository.PlanConnectionDescription.class) {
      super.initPart(key, kind, element, allResource);
    }
    if (key == DeploymentViewsRepository.ConnectionEnds.class) {
      super.initPart(key, kind, element, allResource);
    }
    if (key == DeploymentViewsRepository.Requirements.class) {
      super.initPart(key, kind, element, allResource);
    }
  }
}
